package com.qianfeng.goods.service;

import java.util.List;

import com.qianfeng.goods.bean.Goods;
import com.qianfeng.goods.mapper.GoodsMapper;
import com.qianfeng.utils.DBUtils;

public class GoodsService {

	/*
	 * 查询所有的商品分类信息
	 */
	public List<Goods> getList(Goods goods) {
		GoodsMapper goodsMapper = DBUtils.getMapper(GoodsMapper.class);
		List<Goods> list = goodsMapper.getList(goods);
		DBUtils.release();
		return list;
	}

	public int getCount(Goods goods) {
		GoodsMapper goodsMapper = DBUtils.getMapper(GoodsMapper.class);
		int num = goodsMapper.getCount(goods);
		DBUtils.release();
		return num;
	}

	/**
	 * 根据id查询分类的详细信息
	 * 
	 * @param id
	 * @return
	 */
	public Goods getById(long id) {
		GoodsMapper goodsMapper = DBUtils.getMapper(GoodsMapper.class);
		Goods goods = goodsMapper.getById(id);
		DBUtils.release();
		return goods;
	}

}
